data = readmatrix('data.xlsx');
X = data(: ,1:3);
Y = data(:, 4:20);

numObjections = size(X);
numObjections = numObjections(1);
[idxTrain, idxValidation, idxTest] = dividerand(numObjections, 0.7, 0.15, 0.15);

XTrain = X(idxTrain, :);
YTrain = Y(idxTrain, :);

XValidation = X(idxValidation, :);
YValidation = Y(idxValidation, :);

options = trainingOptions("adam", ...
    MaxEpochs=2000, ...
    InitialLearnRate=0.001, ...
    GradientThreshold=1, ...
    ValidationData={XValidation, YValidation}, ...
    Plots="training-progress");

net = trainnet(XTrain, YTrain, net_2, "mse", options);

exportONNXNetwork(net, "model.onnx");